package com.daaug.demo.robotlegs.texttospeech
{
	import com.daaug.demo.robotlegs.texttospeech.commands.GetRemoteAudioCommand;
	import com.daaug.demo.robotlegs.texttospeech.events.TTSEvent;
	import com.daaug.demo.robotlegs.texttospeech.models.TxtAudioModel;
	import com.daaug.demo.robotlegs.texttospeech.services.GoogleTranslateService;
	import com.daaug.demo.robotlegs.texttospeech.views.TTSForm;
	import com.daaug.demo.robotlegs.texttospeech.views.TTSFormMediator;
	
	import flash.display.DisplayObjectContainer;
	
	import org.robotlegs.mvcs.Context;
	
	public class ApplicationContext extends Context
	{
		public function ApplicationContext(contextView:DisplayObjectContainer=null, autoStartup:Boolean=true)
		{
			super(contextView, autoStartup);
		}
		
		override public function startup():void {
			
			// Controller (Events/Commands)
			commandMap.mapEvent(TTSEvent.CONVERT_TEXT, GetRemoteAudioCommand, TTSEvent, false);
			
			// Services
			injector.mapSingleton(GoogleTranslateService);
			
			// Models
			injector.mapSingleton(TxtAudioModel);
			
			// Views
			mediatorMap.mapView(TTSForm, TTSFormMediator);
			
			trace("startup");
			
			super.startup();
		}
	}
}